import ADTs.PointADT;
import junit.framework.Assert;
import junit.framework.Test;
import junit.framework.TestCase;
import junit.framework.TestSuite;



public class PointADTTest extends TestCase{
	public static Test suite() {
		return new TestSuite(PointADTTest.class);
	}
	
	public void testScaleTo(){
		PointADT p = new PointADT(10,10);
		p.scaleToMagnitude(1000);
		Assert.assertEquals(1000, p.getMagnitude(), .01);
	}
	
	public void testScale(){
		PointADT p = new PointADT(10,10);
		double origmag = p.getMagnitude();
		p.scale(1000);
		Assert.assertEquals(1000 * origmag, p.getMagnitude(), .01);
	}
	
	public void testNormalize(){
		PointADT p = new PointADT(Math.random()*1000,Math.random()*1000);
		p.normalize();
		Assert.assertEquals(1, p.getMagnitude(), .01);
	}
	
	public void testxAdd(){
		PointADT p = new PointADT(10,10);
		p.xAdd(10);
		Assert.assertEquals(20, p.getX(), .01);
	}
	
	public void testdot(){
		PointADT p1 = new PointADT(2,3);
		PointADT p2 = new PointADT(4,5);

		Assert.assertEquals(23, p1.dot(p2), .01);
	}
	
	public void testcopy(){
		PointADT p1 = new PointADT(10,10);
		Assert.assertTrue(p1 != p1.copy());
		Assert.assertEquals(p1.getX(), p1.copy().getX(), .01);
		Assert.assertEquals(p1.getY(), p1.copy().getY(), .01);
	}
	
}
